package user;

import java.util.Scanner;

import book.BookShelf;
import operation.*;


public class AdminUser extends User {

    public AdminUser(String userName) {
        super(userName);
    }

    @Override
    public int menu() {
        System.out.println("*******************");
        System.out.println("hello " + this.userName + " 欢迎来到管理员菜单");
        System.out.println("1:查找图书");
        System.out.println("2:新增图书");
        System.out.println("3:删除图书");
        System.out.println("4:显示图书");
        System.out.println("0:退出系统");
        System.out.println("*******************");
        System.out.println("请输入您的操作：");
        Scanner in = new Scanner(System.in);
        int select = in.nextInt();
        return select;
    }

    Operation[] method = {
            new ExitOperation(),
            new FindOperation(),
            new AddOperation(),
            new DelOperation(),
            new ShowOperation()
    };

    @Override
    public void operation(int select, BookShelf bookShelf) {
        if (select >= 0 && select <= 4) {
            this.method[select].work(bookShelf);
        } else {
            System.out.println("输入错误，请重新输入!");
            System.out.println();
        }
    }
}